package com.dm.db.condition;

import com.dm.config.properties.SystemProperties;
import com.dm.db.DBTypeEnum;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;


public class MysqlCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

        Environment environment = conditionContext.getEnvironment();
        String property = environment.getProperty("system.config.jdbc-type");
        if(property.equals(DBTypeEnum.mysql.getName())){
            return true;
        }
        return false;
    }
}
